<script type="text/javascript" src="/javascripts/swfobject.js"></script>
<div id="basicListing">
  <h1>Events & Traces by Date</h1>
  <ul id="tracesByDayNav">
    <% @traces_by_day.each do |day,traces| %>
    <li>
      <span class="byDateHeader"><%= day.strftime("%A (%m/%d/%Y)") %></span>
      <span class="hiddenTable">
        <% @minToday = traces.sum(&:minSpent) %>
        <% @sortedDay = traces.sort! {|x,y| x.event_id <=> y.event_id } %>
        <% @groupedTraces = @sortedDay.group_by{|e| e.event} %>
        <table>
        <% @groupedTraces.each do |eventThisDay,tracesThisEvent| %>
          <% @minThisEvent = tracesThisEvent.sum(&:minSpent) %>
          <tr>
            <td align="right" width="20"><%= "%02d:%02d" % [(@minThisEvent / 60),(@minThisEvent % 60)] %></td>
            <td align="left"><%= eventThisDay.title %> (<%= eventThisDay.ticketNumber %>)</td>
          </tr>
        <% end %>
        <tr><td align="right" width="20" class="sumTotal"><%= "%02d:%02d" % [(@minToday / 60),(@minToday % 60)] %></td><td> </td></tr>
        </table>
        
      </span>
    </li>
  <% end %>
  </ul>
</div>
